#!/bin/bash 

function my_add_1(){
	NUM=$(($1+$2))
}

my_add_1 10 20
echo $NUM  # 30 
my_add_1 100 200
echo $NUM  # 300

echo "-----------------------------"

function my_add_2(){
	NUM=$(($1+$2))
	return $NUM
}

my_add_2 10 20
echo $?  # 300
my_add_2 100 200
echo $?  # 44   因为只能返回 [0-255] 的值 300超过范围 被截断了

echo "-----------------------------"

function my_add_3(){
	NUM=$(($1+$2))
	echo $NUM
}

RET=`my_add_3 10 20`
echo $RET  #  30 
RET=$(my_add_3 1000 2000)
echo $RET  #  3000

